package com.annotation.validator;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class EmailValidator extends FieldValidatorSupport{
	/**
	 * email正则表达式
	 */
	public static final Pattern EMAIL_PATTERN = Pattern
			.compile("^\\w+(\\.\\w+)*@\\w+(\\.\\w+)+$");
	@Override
	public void validate() {
		String value=getFieldValue();
		Matcher m = EMAIL_PATTERN.matcher(value);
		if (!m.matches()) {
			addErrorCode(this.getFieldName(),this.getMessage());
		}
	}

}
